package com.example.demo;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;

import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.interfaces.OnConfirmListener;
import com.lxj.xpopup.interfaces.OnSelectListener;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = "MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        findViewById(R.id.button1).setOnClickListener(v -> {
            new XPopup.Builder(this)
                    .asBottomList("底部选择", new String[]{"A", "B"}, new OnSelectListener() {
                        @Override
                        public void onSelect(int position, String text) {
                            Log.d(TAG, "点击了" + position);
                        }
                    }).show();
        });

        findViewById(R.id.button2).setOnClickListener(v -> {
            new XPopup.Builder(this)
                    .asConfirm("确认", "内容", new OnConfirmListener() {
                        @Override
                        public void onConfirm() {
                            Log.d(TAG, "确认");
                        }
                    }).show();
        });
    }

}